#ifndef MINSTACK_H
#define MINSTACK_H

#include <iostream>
#include <stack>

using namespace std;

class minStack
{
public:
	void push(int value) {
		data_s.push(value);
		if (min_s.empty())
			min_s.push(value);
		else if (value < min_s.top())
			min_s.push(value);
		else
			min_s.push(min_s.top());
	}
	void pop() {
		data_s.pop();
		min_s.pop();

	}
	int top() {
		return data_s.top();
	}
	int min() {
		return min_s.top();
	}

private:
	stack<int> data_s;
	stack<int> min_s;
};
#endif // !MINSTACK_H
